#pragma once
#include "PairedReadsSet.h"
#include "FileOutputBuffer.h"

class CLongReadsSet : public CPairedReadsSet
{
public:
    CLongReadsSet(void);
    CLongReadsSet (const char* InputFile, const char* fileFormat,\
                   unsigned int expReadStrLineLength, unsigned int allowedNumOfNinRead, unsigned int readStartIndex);
    ~CLongReadsSet(void);
    void init(const char* InputFile, const char* fileFormat,\
              unsigned int expReadStrLineLength, bool in5to3cat3to5Format, unsigned int allowedNumOfNinRead, unsigned int readStartIndex = 0);
    unsigned int get_next_capacity_reads(int capacity, char sep);
    bool save_next_read(bool bSOLiDReadFormat, bool getQScores);
    inline void reserve(int capacity);
    inline int capacity(void);
    inline int size(void);
    inline bool bStoreQS(void);
    inline unsigned int getReadLength() {
        return(this->longReadLength);
    };
    inline const char* readSetName() {
        return(this->F_Reads->InputFile);
    };
    const char* get_Next_Read(void);
    void setBadReadOutputFile(FileOutputBuffer* pOut);
private:
    unsigned int longReadLength;
    inline unsigned int getHalfReadLength() {
        return(this->uiRead_Length);
    };
    bool save_next_long_read(bool bSOLiDReadFormat, bool getQScores, bool in5to3cat3to5Format);
    inline void save_next_long_Illumina_read(unsigned int fullReadLength, bool getQScores, bool in5to3cat3to5Format);
    inline void save_next_long_SOLiD_read(unsigned int fullReadLength, bool getQScores);
};

inline int CLongReadsSet::size()
{
    int size1 = this->R_Reads->pReadsSet->size();
    int size2 = this->F_Reads->pReadsSet->size();
    // Two half should be the same
    return(min(size1,size2));
};

inline int CLongReadsSet::capacity(void)
{
    int c1 = this->R_Reads->pReadsSet->capacity();
    int c2 = this->F_Reads->pReadsSet->capacity();
    // Two half should be the same
    return(min(c1, c2));
};

inline bool CLongReadsSet::bStoreQS(void)
{
    return(this->F_Reads->pQualScores != NULL && this->R_Reads->pQualScores != NULL);
};

inline void CLongReadsSet::reserve(int capacity)
{
    this->R_Reads->pReadsSet->reserve(capacity);
    this->F_Reads->pReadsSet->reserve(capacity);
};
